package com.fplanning.planner.business;

import java.util.ArrayList;
import java.util.List;

import com.fplanning.planner.domain.FISlice;
import com.fplanning.planner.domain.IFinancialInstrument;
import com.fplanning.planner.domain.RRSPType;
import com.fplanning.planner.domain.SavingsType;
import com.fplanning.planner.domain.YearlyPlan;

public class TaxCalculator
{

    public static double calculateTax(final YearlyPlan yearlyPlan)
    {
        double result = 0;

        double totalAmount = yearlyPlan.calculateTotalTaxable();

        // apply a pct for now
        result = 30 * totalAmount / 100;

        return result;
    }

    /**
     * @param args
     */
    public static void main(String[] args)
    {
        RRSPType rrspType = new RRSPType();
        rrspType.setAmount(256);

        SavingsType savings = new SavingsType();
        savings.setAmount(300000);

        YearlyPlan year1 = new YearlyPlan();
        year1.setId(1);
        year1.setRequiredAmount(40000);

        List<FISlice> fiSlices = new ArrayList<FISlice>();
        FISlice slice1 = new FISlice();
        slice1.setfInstrument(savings);
        slice1.setWeightPct(20);
        fiSlices.add(slice1);

        FISlice slice2 = new FISlice();
        slice2.setfInstrument(rrspType);
        slice2.setWeightPct(80);
        fiSlices.add(slice2);

        year1.setFiSlices(fiSlices);

        double tax = TaxCalculator.calculateTax(year1);

        System.out.println(tax);

    }

}
